import {
  getBankProductionsList,
  getFastProductionsList,
  addOneFastProduct,
  updateOneFastProduct,
  getFastProductByID,
  deleteFastProductByIDs,
  addOneBankProduct,
  updateOneBankProduct,
  getBankProductByID,
  deleteBankProductByIDs
} from '@/api/production'

const production = {
  state: {
  },

  mutations: {
  },

  actions: {
    // 查询银行产品列表
    getBankProductList({ commit }, condition) {
      return new Promise((resolve, reject) => {
        getBankProductionsList(condition).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 查询快速产品列表
    getFastProductList({ commit }, condition) {
      return new Promise((resolve, reject) => {
        getFastProductionsList(condition).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 添加一个快速贷产品
    addOneFastProduct({ commit }, data) {
      return new Promise((resolve, reject) => {
        addOneFastProduct(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 更新一个快速贷产品
    updateOneFastProduct({ commit }, data) {
      return new Promise((resolve, reject) => {
        updateOneFastProduct(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 根据id查询快速贷产品详情
    getFastProductByID({ commit }, id) {
      return new Promise((resolve, reject) => {
        getFastProductByID(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 根据id批量删除银行贷产品
    deleteFastProductByIds({ commit }, data) {
      return new Promise((resolve, reject) => {
        deleteFastProductByIDs(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 添加一个银行贷产品
    addOneBankProduct({ commit }, data) {
      return new Promise((resolve, reject) => {
        addOneBankProduct(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 更新一个银行贷产品
    updateOneBankProduct({ commit }, data) {
      return new Promise((resolve, reject) => {
        updateOneBankProduct(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 根据id查询银行贷产品详情
    getBankProductByID({ commit }, id) {
      return new Promise((resolve, reject) => {
        getBankProductByID(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 根据id批量删除银行贷产品
    deleteBankProductByIds({ commit }, data) {
      return new Promise((resolve, reject) => {
        deleteBankProductByIDs(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default production
